<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/9/11
  Time: 17:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="../common/include.jsp" %>
<html>
<head>
    <title>Title</title>
    <script src="js/allDemand.js"></script>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content  animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox ">
                <div class="ibox-content">

                    <div class="jqGrid_wrapper">
                        <div class="ui-jqgrid " id="gbox_table_list_2" dir="ltr">
                            <div class="ui-jqgrid-view table-responsive" role="grid" id="gview_table_list_2"
                            >


                                <form role="form" class="form-inline" style="margin-bottom: 10px" id="searchForm"
                                      method="post" action="allBugList.html">

                                    <div class="form-group">
                                        <select onchange="queryDemand()" id="demandType"
                                                     name="conditions['demandType']" class="form-control"
                                                     required="" aria-required="true">
                                            <option value="0"
                                                    <c:if test="${pages.conditions.demandType == 0}">selected</c:if>>全部
                                            </option>
                                        <option value="1"
                                                <c:if test="${pages.conditions.demandType == 1}">selected</c:if>>BUG
                                        </option>
                                        <option value="2"
                                                <c:if test="${pages.conditions.demandType == 2}">selected</c:if>>需求
                                        </option>
                                        <option value="3"
                                                <c:if test="${pages.conditions.demandType == 3}">selected</c:if>>操作
                                        </option>
                                    </select>
                                        &nbsp;&nbsp;&nbsp;

                                        <input type="text" name="conditions['createName']" placeholder="录入人"
                                                   value="${pages.conditions.createName}" size="8"
                                                   id="createName" class="form-control">&nbsp;&nbsp;&nbsp;
                                        <input  name="conditions['currentPrincipal']" id="currentPrincipal" placeholder="责任人"
                                                type="text" size="8" value="${pages.conditions.currentPrincipal}"
                                                class="form-control">&nbsp;&nbsp;&nbsp;
                                        <input  name="conditions['joinName']" id="joinName" placeholder="参与人"
                                                type="text" size="8" value="${pages.conditions.joinName}"
                                                class="form-control">&nbsp;&nbsp;&nbsp;
                                        <input type="text" name="conditions['detail']" placeholder="问题描述"
                                               value="${pages.conditions.detail}" size="8"
                                               id="detail" class="form-control">&nbsp;&nbsp;&nbsp;
                                        <select id="demandProduct" name="conditions['demandProduct']"
                                                     class="form-control"
                                                     required="" aria-required="true">
                                        <option value="0"
                                                <c:if test="${pages.conditions.demandProduct == 0}">selected</c:if>>
                                            问题产品
                                        </option>
                                            <c:forEach items="${productList}" var="product">
                                                <option <c:if test="${pages.conditions.demandProduct == product.id}">selected</c:if> value="${product.id}">${product.product_name}</option>
                                            </c:forEach>
                                    </select>


                                    </div>
                                    &nbsp;&nbsp;&nbsp;
                                    <div class="form-group">
                                        <select id="status"
                                                   name="conditions['status']" class="form-control"
                                                   required="" aria-required="true">
                                        <option value="0">进度
                                        </option>
                                        <option value="1"
                                                <c:if test="${pages.conditions.status == 1}">selected</c:if>>待审核
                                        </option>
                                        <option value="2"
                                                <c:if test="${pages.conditions.status == 2}">selected</c:if>>待开发
                                        </option>
                                        <option value="3"
                                                <c:if test="${pages.conditions.status == 3}">selected</c:if>>处理中
                                        </option>
                                        <option value="4"
                                                <c:if test="${pages.conditions.status == 4}">selected</c:if>>已处理
                                        </option>
                                        <option value="6"
                                                <c:if test="${pages.conditions.status == 6}">selected</c:if>>已驳回
                                        </option>


                                    </select>
                                    </div>
                                    &nbsp;&nbsp;&nbsp;
                                    <div class="form-group">

                                    <input readonly  id="beginTime" placeholder="录入时间"
                                           onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"
                                           name = "conditions['beginTime']"
                                           value="${pages.conditions.beginTime}"
                                           type="text" size="8"
                                           class="form-control">--
                                        <input readonly name = "conditions['endTime']" id="endTime" placeholder="录入时间"
                                               onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"
                                               type="text" size="8"
                                               value="${pages.conditions.endTime}"
                                               class="form-control">
                                    </div>
                                    &nbsp;&nbsp;&nbsp;
                                    <div class="form-group" style="width: 100%;text-align: center;margin-top: 5px">
                                        <button type="button" onclick="queryDemand()"
                                                class="btn btn-primary">搜索
                                        </button>    &nbsp;&nbsp;&nbsp;
                                        <button type="button" id="exportBtn" class="btn btn-primary">导出</button>
                                        &nbsp;&nbsp;&nbsp;<button type="button" id="resetBut" class="btn btn-reset">重置


                                    </button>

                                    </div>
                                </form>


                                <div class="ui-jqgrid-bdiv">
                                    <div style="position:relative;">
                                        <div></div>
                                        <table id="cusTable"
                                               class="ui-jqgrid-btable ui-common-table table table-bordered"
                                        >
                                            <tbody>
                                            <tr role="row" style="background: #F5F5F5;">
                                                <!--<td><input th:type="checkbox" name="ches"/>-->
                                                </td>
                                                <td >反馈人
                                                </td>
                                                <td>所属产品

                                                </td>
                                                <td>录入人
                                                </td>

                                                <td style="width: 15%">录入时间
                                                </td>


                                                <td>
                                                    状态
                                                </td>
                                                <td>
                                                    责任人
                                                </td>
                                                <td>操作
                                                </td>
                                            </tr>


                                            <c:forEach items="${pages.pageDatas}" var="bug">
                                                <tr role="row" tabindex="-1" id="${bug.id}"
                                                    statusText="${bug.status_text}"  demandType="${bug.demandType}"
                                                    class="jqgrow ui-row-ltr">

                                                    <td>
                                                            ${bug.feedback_name}
                                                    </td>
                                                    <td>
                                                        <c:if test="${bug.demand_product ==1}">
                                                            中环E家-房源
                                                        </c:if>
                                                        <c:if test="${bug.demand_product ==2}">
                                                            中环E家-客源
                                                        </c:if>
                                                        <c:if test="${bug.demand_product ==3}">
                                                            中环E家-数据
                                                        </c:if>
                                                        <c:if test="${bug.demand_product ==4}">
                                                            中环E家-交易
                                                        </c:if>
                                                        <c:if test="${bug.demand_product ==5}">
                                                            中环E家-财务
                                                        </c:if>
                                                        <c:if test="${bug.demand_product ==6}">
                                                            中环E家-行政
                                                        </c:if>
                                                        <c:if test="${bug.demand_product ==7}">
                                                            IOS端
                                                        </c:if>
                                                        <c:if test="${bug.demand_product ==8}">
                                                            Android端
                                                        </c:if>
                                                        <c:if test="${bug.demand_product ==9}">
                                                            网站
                                                        </c:if>
                                                    </td>
                                                    <td>
                                                            ${bug.create_name}
                                                    </td>

                                                    <td>
                                                            ${bug.create_time}
                                                    </td>

                                                    <td>
                                                        <c:if test="${bug.is_suspend == 2}">已暂停</c:if>
                                                        <c:if test="${bug.is_suspend != 2}"> ${bug.status_text}</c:if>

                                                    </td>
                                                    <td>
                                                            ${bug.current_principal}
                                                    </td>

                                                    <td>
                                                        <!-- 暂停和开始按钮 -->
                                                        <c:if test="${bug.is_suspend != 2 && bug.status <= 3}">

                                                            <a id="chbtn" bugId="${bug.id}"
                                                                    isSuspend="2" title="暂停"
                                                                    suspendId="${bug.suspend_id}"
                                                                    class="handleicon" type="button">
                                                                    <i class="fa fa-minus-circle"></i>
                                                            </a>
                                                        </c:if>

                                                        <c:if test="${bug.is_suspend == 2  && bug.status <= 3}">

                                                            <a id="chbtn" bugId="${bug.id}" title="开始"
                                                                    isSuspend="1" suspendId="${bug.suspend_id}"
                                                                    class="handleicon" type="button">
                                                                    <i class="fa fa-play-circle"></i>
                                                            </a>
                                                        </c:if>
                                                    </td>
                                                </tr>

                                            </c:forEach>


                                            </tbody>
                                        </table>
                                        <c:if test="${pages.totalPages>1 }">
                                            <page:pager pageSize="${pages.pageSize}" currPage="${pages.currPage}"
                                                        totalRecords="${pages.totalRecords}"
                                                        url="${pageContext.request.contextPath}/allBugList.html?
                                                        conditions['demandProduct']=${pages.conditions.demandProduct }
                                                        &conditions['createName']=${pages.conditions.createName }
                                                        &conditions['status']=${pages.conditions.status }
                                                        &conditions['beginTime']=${pages.conditions.beginTime }
                                                        &conditions['endTime']=${pages.conditions.endTime }
                                                        &conditions['joinName']=${pages.conditions.joinName }
                                                        &conditions['currentPrincipal']=${pages.conditions.currentPrincipal }
                                                        &conditions['datail']=${pages.conditions.datail }"/>

                                        </c:if>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

</body>

<script>


    $(function () {

        var index = 0;

        $("[id = chbtn]").click(function () {

            var title = "暂停-处理";

            var isSuspend = $(this).attr('isSuspend');
            if (1 == isSuspend) {
                title = "开始-处理";
            }

            //alert($(this).html());
            //alert($(this).attr('status'));
            //alert($(this).attr('bug_id'));
            //alert($(this).parent('tr').attr('custId'));
            index = layer.open({
                type: 2,
                title: title,
                skin: 'ilayui-layer-rm', //加上边框
                area: ['30%', '50%'], //宽高
                content: 'goSuspendBug.html?&id=' + $(this).attr('bugId') + "&isSuspend=" + isSuspend
                + "&suspendId=" + $(this).attr('suspendId')
//                end: function () {
//                    location.reload();
//                }
            });
        });

    });


    $("[id = exportBtn]").click(function ()  {

        //可以点击一个按钮事件触发下面的代码进行导出
//        window.open("partExport.html","_blank");
        //或者可以提交表单
        $('#searchForm').attr('action','partExport.html');
        $('#searchForm').attr('target','_blank');
        $('#searchForm').submit();
    });

</script>
</html>
